package org.example.Day4.Regex;

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args){
        checkEmail();
    }
    public static void checkEmail(){
        while (true){
            System.out.println("请输入邮箱");
            Scanner sc = new Scanner(System.in);
            String email = sc.nextLine();
            if(email.matches("\\w{2,}@\\w{2,20}(\\.\\w{2,10}){1,2}")){
                System.out.println("您输⼊的邮箱格式正确~~~");
                break;
            }else{
                System.out.println("重新输入");
            }
        }
    }
}
